package main

import "fmt"

func main() {
	var intChan chan int = make(chan int, 100)
	for i := 0; i < 100; i++ {
		intChan <- i
	}

	// 遍历之前先要关闭管道，不然会出错误
	close(intChan)
	for v := range intChan {
		fmt.Printf("%v ", v)
	}
	fmt.Println()
}
